#include<bits/stdc++.h>
#define int long long
using namespace std;
int q;
multiset<tuple<int,int,int>>s;
inline int check()
{
	auto [w1,w2,w3]=*s.begin();
	if(s.size()==1)
	{
		return w1;
	}
	int k=w1,ans=w1;
	for(auto [q1,q2,q3]:s)
		for(auto [s1,s2,s3]:s)
			{
				int len=0;
				if(q2<s2)
				{
					if(q3<s3)
						len=max(0ll,q3-s2);
					else
						len=max(0ll,s3-s2);
				}
				else
				{
					if(q3>s3)
						len=max(0ll,q3-q2);
					else
						len=max(0ll,s3-q2);
				}
				if(len<k)
				{
					k=len;
					ans=max(s3,q3)-min(s2,q2);
				}
				else if(len==k)
					ans=min(ans,max(s3,q3)-min(s2,q2));
			}
	return ans;
}
signed main()
{
	freopen("stone.in","r",stdin);
	freopen("stone.out","w",stdout);
	ios::sync_with_stdio(false);
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cin>>q;
	while(q--)
	{
		char op;
		cin>>op;
		if(op=='A')
		{
			int l,r;
			cin>>l>>r;
			s.emplace(r-l,l,r);
		}
		else if(op=='R')
		{
			int l,r;
			cin>>l>>r;
			s.erase({r-l,l,r});
		}
		cout<<check()<<'\n';
	}
	return 0;
}
